import axios from '@/api/fetch';
//import * as types from './types';
import SERVER from '@/api/server';

//旧件出库
//旧件出库 - 主页面查询
export const getListByPage = params => axios.post(`${SERVER.CLAIMFAC}/rPReturnOut/getListByPage`,  params );
//新增的保存
export const newSave = params => axios.post(`${SERVER.CLAIMFAC}/rPReturnOut/saveOne`,  params );
//批量启动
export const piliangqiyong = data => axios.post(`${SERVER.CLAIMFAC}/rPReturnOut/updateEnableByIds`,  null ,{params : data} );
//旧件仓库下拉列表带条件查询
export const getListByExampleWhere = (params) => axios.get(`${SERVER.CLAIMFAC}/returnStockInfo/sqlAllWhName`,{params});
//批量停用
export const piliangtingyong = data => axios.post(`${SERVER.CLAIMFAC}/rPReturnOut/updateEnableByIds`,  null ,{params : data} );
//Excel导出
// export const excelExport = params => axios.get(`${SERVER.CLAIMFAC}/rPReturnWhMp/getListForExport`, params);
// export const excelExport = params => axios.post(`${SERVER.CLAIMFAC}/rPReturnWhMp/getListForExport`,  params );
//打印
export const generateReturnBoxList = params => axios.get(`${SERVER.CLAIMFAC}/rPReturnOut/selectById/${params.id}`);
// 选择旧件列表
export const getStockListByPage = params => axios.post(`${SERVER.CLAIMFAC}/returnStockInfo/getAllStockMessage`,  params );
// 选择旧件列表2
export const getAllStockInfo = params => axios.post(`${SERVER.CLAIMFAC}/returnStockInfo/getAllStockInfo`,  params );
//通过ID查
export const selectById = params => axios.get(`${SERVER.CLAIMFAC}/rPReturnOut/selectById/${params.id}`);

//旧件列表查
//export const getMessage = params => axios.post(`${SERVER.CLAIMFAC}/returnStockInfo/getAllStockMessage`, params);
//获取出库单号的
export const getOutNo = params => axios.get(`${SERVER.CLAIMFAC}/returnStockInfo/getOutNo`, { params });
//查明细
export const selectDetailById = params => axios.get(`${SERVER.CLAIMFAC}/rPReturnOut/selectDetailById/${params.id}`);

export const excelExport = params => {
  return axios({
    url:`${SERVER.CLAIMFAC}/rPReturn/getListForExport`,
    method: 'get',
    params: params,
    responseType: 'blob'
  });
};
//编辑回显
export const selectEditById = params => axios.get(`${SERVER.CLAIMFAC}/rPReturnOut/selectUpdateById/${ params.outId }` );
//一般车辆配件类型保修期编辑弹窗的保存
export const editSave = params => axios.post(`${SERVER.CLAIMFAC}/rPReturnOut/updateByPtId/`,params  );

//导出
export const getListForExport = (params) => axios.post(`${SERVER.CLAIMFAC}/rPReturnOut/getListForExport`, params, {
  responseType: 'blob'
});
  //下载中心导出
  export const exporturl = params => axios.post(`/api/cmscloud.excel/downloadExcel/exportExcel/${params.CODE}`, params);
// 出库撤回
export const withdraw = params => axios.get(`${SERVER.CLAIMFAC}/rPReturnOut/channelById`, { params });


//打印
export const printById = params => axios.get(`${SERVER.CLAIMFAC}/rPReturnOut/printById/${params.id}`);


//导出模版
export const exportTemplate = params => {
  const url = `${SERVER.CLAIMFAC}/rPReturnDtl/exportTemplate`;
  return axios({
    url,
    method: 'post',
    responseType: 'blob'
  });
};
